Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(settings): fixed inability to rename categories when they have blank names #1050

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JackDotJS
Copy link

This PR fixes a minor issue where using blank names in categories would lead to them being permanently* stuck as such.

Blank names are already prohibited, evident from the 400 error you receive if you try creating a category without entering anything in the name field. For some reason though, simple whitespace characters (including U+0020) are allowed. When this happens, the category gets stuck with a blank name due to the <span> element ending up with a size of 0x0, and since the click handler responsible for allowing the user to rename the category is attached to that same <span> element, you can kinda see how it goes wrong.

I realize that a change to the backend to improve handling of whitespace characters would be the more ideal solution, but this change on the frontend is incredibly simple, and it would also be nice for handling future edge cases if a similar exploit is found again.

*unless you have access to devtools, of course.

Please make sure to check the following tasks before opening and submitting a PR

  • I understand and have followed the contribution guide
  • I have tested my changes locally and they are working as intended
  • These changes do not have any notable side effects on other Revolt projects
  • (optional) I have opened a pull request on the translation repository
  • I have included screenshots to demonstrate my changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 Untriaged
Development

Successfully merging this pull request may close these issues.

1 participant